﻿@model IEnumerable<FCNS.ERP.Models.ErpOrderPay>

@{
    ViewBag.Title = "收支单";
    Layout ="~/Views/Shared/_Layout.cshtml";
}

<h2>@ViewBag.Title</h2>
<link href="~/WebExtend/AlertForm/jquery.dialogbox-1.0.css" rel="stylesheet" />
<script src="~/WebExtend/AlertForm/jquery.dialogbox-1.0.js"></script>
<script>
    $(document).ready(function () { 
        var allBank = '';
       var bl="@ViewBag.BankList";
        var arr =bl.split(';');
        for (var i in arr) {
            if (arr[i].length > 2) {
                var t1 = arr[i].split(',');
                var temp = '<div style="display:table-row;"><div style="display:table-cell;"><input type="radio" name="companyRdoID" id="companyRdoID'+t1[0];
                temp += ('" value="' + t1[0]);
                temp += ('"></div><div style="display: table - cell; "><label for="companyRdoID' + t1[0]);
                temp += ('">' + t1[1] + '</label></div></div>');
                allBank += temp;
            }
        }

        $(".alertForm").click(function () {
            var orderId=$(this).attr("data-Id");
            $('body').dialogbox({
                type: "normal", title: "选择金额账户",
                buttons: [{
                    Text: "提交",
                    ClickToClose: true,
                    callback: function (dialog) {
                        var id1 = $(dialog).find("input[name='companyRdoID']:checked").val();
                        returnData = {
                            "ID": id1
                        };

                        if (!isNaN(returnData.ID)) {
                            window.location.replace("OrderPayShenHe?Id=" + orderId + "&bankId=" + returnData.ID);
                        } else {
                            alert('请选择金融账户');
                        }
                    }
                }],
                message: '<div id="companySelectFotmTable" style="display:table;width:100%;">' + allBank+ '</div>'
            });
        });
    });
</script>
<p>
    <a class="newObjA" href="/Pay/OrderPayNew">新增</a>
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.PayType)
        </th>

        <th>
            @Html.DisplayNameFor(model => model.CorSId)
        </th>

        <th>
            @Html.DisplayNameFor(model => model.RelatedOrderNO)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.DateTimeStart)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Money)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Summary)
        </th> 
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.PayType)
            </td>

            <td>
                @Html.DisplayFor(modelItem => item.CorS.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.RelatedOrderNO)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.DateTimeStart)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Money)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Summary)
            </td> 
            <td>

                @if (item.CanDeleteByUser)
    {
            @Html.ActionLink("编辑", "OrderPayEdit", new { id = item.Id }); @Html.Raw(" | ");
            <a href="OrderPayDelete/@item.Id" class="objDelete">删除 | </a>
            @Html.ActionLink("审核", "OrderPayShenHe", new { id = item.Id })

}
else
{
            @*@Html.ActionLink("打印", "ReportPrint", "House", new { flag = 2, str1 = item.OrderNO }, htmlAttributes: new { @target = "_blank" }); @Html.Raw(" | ");*@
            <a href="#" data-Id="@item.Id" class="alertForm">审核</a>
}
            </td>


        </tr>
    }

</table>
